package com.yunmaozj.tools.lock.interceptor;

import com.yunmaozj.tools.lock.annotations.AnnotationDistributedLockAttributeSource;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.AbstractBeanFactoryPointcutAdvisor;

/**
 * @author 钟明宏
 * @version V1.0
 * @date 2021-08-25 20:16
 **/
public class DistributedLockAttributeSourceAdvisor extends AbstractBeanFactoryPointcutAdvisor {

    private final DistributedLockAttributePointcut pointcut;


    public DistributedLockAttributeSourceAdvisor(AnnotationDistributedLockAttributeSource annotationDistributedLockAttributeSource) {
        pointcut = new DistributedLockAttributePointcut() {
            @Override
            protected AnnotationDistributedLockAttributeSource getTransactionAttributeSource() {
                return annotationDistributedLockAttributeSource;
            }
        };
    }


    @Override
    public Pointcut getPointcut() {
        return pointcut;
    }
}
